import request from '@/utils/request'
// 获取商品详情的接口
export const goodsedit = (id) => {
  return request('/goods', 'get', { id: id })
}
// 获取商品推荐
export const findRelGoods = (id, limit = 16) => {
  return request('/goods/relevant', 'get', { id, limit })
}
// 获取热榜商品
export const findHotGoods = ({ id, type, limit = 3 }) => {
  return request('/goods/hot', 'get', { id, type, limit })
}

/**
 * 获取商品的评价统计信息
 * @param {String} id - 商品ID
 */
// export const findCommentInfoByGoods = (id) => {
//   return request(`/goods/${id}/evaluate`)
// }
// 上面的接口没数据，用这个代替
export const findCommentInfo = (id) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate`, 'get', { id: id })
}

// * 查询商品评价列表
// * @param {String} id - 商品ID
// * @param {Object} params - 商品ID
// * @returns
// */
export const findGoodsCommentList = (id, params) => {
  return request(`https://mock.boxuegu.com/mock/1175/goods/${id}/evaluate/page`, 'get', params)
}
